<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAuthorizationRequestsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('authorization_requests', function (Blueprint $table) {
            $table->increments('id')->comment('采购商申请授权表');
            $table->integer('provider_id')->unsigend()->comment('供应商 id');
            $table->integer('purchaser_id')->unsigend()->comment('采购商 id');
            $table->string('company_name')->comment('公司名称');
            $table->string('name')->comment('联系人名称');
            $table->string('phone')->comment('联系人电话');
            $table->string('email')->comment('联系人邮箱');
            $table->string('message')->comment('联系人留言');
            $table->tinyInteger('sex')->unsigend()->comment('性别');
            $table->unique(['provider_id', 'purchaser_id']);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('authorization_requests');
    }
}
